24FD

Technical details

Show code
library(GeoPressureR)
library(leaflet)
library(leaflet.extras)
library(raster)
library(dplyr)
library(ggplot2)
library(kableExtra)
library(plotly)
library(GeoLocTools)
setupGeolocation()
knitr::opts_chunk$set(echo = FALSE)
load(paste0("../data/1_pressure/", params$gdl_id, "_pressure_prob.Rdata"))
load(paste0("../data/2_light/", params$gdl_id, "_light_prob.Rdata"))
load(paste0("../data/3_static/", params$gdl_id, "_static_prob.Rdata"))
load(paste0("../data/4_basic_graph/", params$gdl_id, "_basic_graph.Rdata"))

Settings used

All the results produced here are generated with (1) the raw geolocator data, (2) the labeled files of pressure and light and (3) the parameters listed below.

Show code
kable(gpr) %>% scroll_box(width = "100%")
include gdl_id crop_start crop_end thr_dur extent_N extent_W extent_S extent_E map_scale map_max_sample map_margin prob_map_s prob_map_thr shift_k kernel_adjust calib_lon calib_lat calib_1_start calib_1_end calib_2_start calib_2_end calib_2_lon calib_2_lat prob_light_w thr_prob_percentile thr_gs RingNo scientific_name common_name mass wing_span Color
TRUE 24FD 1900-01-01 2100-01-01 16 50 20 -35 120 2 300 30 1 0.9 19800 4 110.69 48.59 2019-06-18 05:15:00 2019-08-10 12:35:00 NA NA NA NA 0.1 0.9 120 NA NA Eurasian Nightjar NA NA NA

Pressure timeserie

The labeling of pressure data is illustrated with this figure. The black dots indicates the pressure datapoint not considered in the matching. Each stationay period is illustrated by a different colored line.

Show code
pressure_na <- pam$pressure %>%
  mutate(obs = ifelse(isoutliar | sta_id == 0, NA, obs))
p <- ggplot() +
  geom_line(data = pam$pressure, aes(x = date, y = obs), colour = "grey") +
  geom_point(data = subset(pam$pressure, isoutliar), aes(x = date, y = obs), colour = "black") +
  # geom_line(data = pressure_na, aes(x = date, y = obs, color = factor(sta_id)), size = 0.5) +
  geom_line(data = do.call("rbind", shortest_path_timeserie) %>% filter(sta_id>0), aes(x = date, y = pressure0, col = factor(sta_id))) +
  theme_bw() +
  scale_colour_manual(values = col) +
  scale_y_continuous(name = "Pressure(hPa)")

ggplotly(p, dynamicTicks = T) %>% layout(showlegend = F)

Light

See geolocator manual for more information on this figure

Show code
raw_geolight <- pam$light %>%
  transmute(
    Date = date,
    Light = obs
  )
lightImage(tagdata = raw_geolight, offset = gpr$shift_k/60/60)
tsimagePoints(twl$twilight,
  offset = gpr$shift_k/60/60, pch = 16, cex = 1.2,
  col = ifelse(twl$deleted, "grey20", ifelse(twl$rise, "firebrick", "cornflowerblue"))
)
abline(v = gpr$calib_2_start, lty = 1, col = "firebrick", lwd = 1.5)
abline(v = gpr$calib_1_start, lty = 1, col = "firebrick", lwd = 1.5)
abline(v = gpr$calib_2_end, lty = 2, col = "firebrick", lwd = 1.5)
abline(v = gpr$calib_1_end, lty = 2, col = "firebrick", lwd = 1.5)

The histogram of zenith angle at the calibration site together with the fitted kernel density. Note that we use a large bandwidth of the kernel to account of the bias of the calibration site.

Show code
hist(z, freq = F)
lines(fit_z, col = "red")

The probability map resulting from light data alone can be seen below.

Show code
li_s <- list()
l <- leaflet(width = "100%") %>%
  addProviderTiles(providers$Stamen.TerrainBackground) %>%
  addFullscreenControl()
for (i_r in seq_len(length(light_prob))) {
  i_s <- metadata(light_prob[[i_r]])$sta_id
  info <- pam$sta[pam$sta$sta_id == i_s, ]
  info_str <- paste0(i_s, " | ", info$start, "->", info$end)
  li_s <- append(li_s, info_str)
  l <- l %>% addRasterImage(light_prob[[i_r]], opacity = 0.8, colors = "OrRd", group = info_str)
}
l %>%
  addCircles(lng = gpr$calib_lon, lat = gpr$calib_lat, color = "black", opacity = 1) %>%
  addLayersControl(
    overlayGroups = li_s,
    options = layersControlOptions(collapsed = FALSE)
  ) %>%
  hideGroup(tail(li_s, length(li_s) - 1))

Light vs Pressure

We can compare light and pressure location at long stationary stopover (>5 days). By assuming the best match of the pressure to be the truth, we can plot the histogram of the zenith angle and compare to the fit of kernel density at the calibration site.

Show code
 raw_geolight <- pam$light %>%
    transmute(
      Date = date,
      Light = obs
    )
 dur <- unlist(lapply(pressure_prob, function(x) difftime(metadata(x)$temporal_extent[2],metadata(x)$temporal_extent[1], units = "days" )))
  long_id <- which(dur>5)

  par(mfrow = c(2, 3))
  for (i_s in long_id){
    twl_fl <- twl %>%
      filter(!deleted) %>%
      filter(twilight>shortest_path_timeserie[[i_s]]$date[1] & twilight<tail(shortest_path_timeserie[[i_s]]$date,1))
    sun <-  solar(twl_fl$twilight)
    z_i <- refracted(zenith(sun, shortest_path_timeserie[[i_s]]$lon[1], shortest_path_timeserie[[i_s]]$lat[1]))
    hist(z_i, freq = F, main = paste0("sta_id=",i_s, " | ",nrow(twl_fl),"twls"))
    lines(fit_z, col = "red")
    xlab("Zenith angle")
  }

Similarly, we can plot the line of sunrise/sunset at the best match of pressure (yellow line) and compare to the raw and labeled light data.

Show code
  lightImage(
    tagdata = raw_geolight,
    offset = gpr$shift_k / 60 / 60
  )
  tsimagePoints(twl$twilight,
                offset = gpr$shift_k / 60 / 60, pch = 16, cex = 1.2,
                col = ifelse(twl$deleted, "grey20", ifelse(twl$rise, "firebrick", "cornflowerblue"))
  )
  for (ts in shortest_path_timeserie){
    twl_fl <- twl %>%
      filter(twilight>ts$date[1] & twilight<tail(ts$date,1))
    if (nrow(twl_fl)>0){
    tsimageDeploymentLines(twl_fl$twilight,
                           lon = ts$lon[1], ts$lat[1],
                           offset = gpr$shift_k / 60 / 60, lwd = 3,col = adjustcolor("orange", alpha.f = 0.5))
      
    }
  }

GeoPressureViz

To visualize the path on GeoPressureViz, you will need to also load the pressure and light probability map and align them first with the code below.

Show code
sta_marginal <- unlist(lapply(static_prob_marginal, function(x) raster::metadata(x)$sta_id))
sta_pres <- unlist(lapply(pressure_prob, function(x) raster::metadata(x)$sta_id))
sta_light <- unlist(lapply(light_prob, function(x) raster::metadata(x)$sta_id))
pressure_prob <- pressure_prob[sta_pres %in% sta_marginal]
light_prob <- light_prob[sta_light %in% sta_marginal]

The code below will open with the shortest path computed with the graph approach. You can change it to

Show code
geopressureviz <- list(
  pam_data = pam,
  static_prob = static_prob,
  static_prob_marginal = static_prob_marginal,
  pressure_prob = pressure_prob,
  light_prob = light_prob,
  pressure_timeserie = shortest_path_timeserie
)
save(geopressureviz, file = "~/geopressureviz.RData")

shiny::runApp(system.file("geopressureviz", package = "GeoPressureR"),
  launch.browser = getOption("browser")
)

Stationay period information

Show code
pam$sta %>% kable()
start end sta_id
2019-06-15 00:00:00 2019-06-18 04:40:00 1
2019-06-18 05:15:00 2019-08-10 12:35:00 2
2019-08-10 13:10:00 2019-08-11 12:40:00 3
2019-08-11 13:15:00 2019-08-13 13:55:00 4
2019-08-13 16:25:00 2019-08-14 12:15:00 5
2019-08-14 19:35:00 2019-08-15 15:10:00 6
2019-08-15 20:20:00 2019-08-16 21:15:00 7
2019-08-16 21:20:00 2019-08-17 12:30:00 8
2019-08-17 12:45:00 2019-08-18 12:20:00 9
2019-08-18 13:00:00 2019-08-19 12:30:00 10
2019-08-19 12:30:00 2019-08-20 12:25:00 11
2019-08-20 12:55:00 2019-08-21 13:05:00 12
2019-08-21 13:10:00 2019-08-22 21:20:00 13
2019-08-22 21:35:00 2019-08-26 12:20:00 14
2019-08-26 21:50:00 2019-08-27 12:50:00 15
2019-08-27 21:55:00 2019-08-28 14:10:00 16
2019-08-28 17:30:00 2019-08-29 14:45:00 17
2019-08-29 20:50:00 2019-08-30 13:55:00 18
2019-08-30 22:20:00 2019-08-31 14:20:00 19
2019-08-31 17:00:00 2019-08-31 19:35:00 20
2019-08-31 22:25:00 2019-09-01 13:55:00 21
2019-09-01 22:50:00 2019-09-02 13:45:00 22
2019-09-02 22:00:00 2019-09-03 15:00:00 23
2019-09-03 23:00:00 2019-09-04 16:25:00 24
2019-09-04 16:40:00 2019-09-05 14:00:00 25
2019-09-05 14:35:00 2019-09-06 23:50:00 26
2019-09-07 00:15:00 2019-09-08 13:45:00 27
2019-09-08 14:10:00 2019-09-09 23:30:00 28
2019-09-10 00:10:00 2019-09-10 13:55:00 29
2019-09-10 15:15:00 2019-09-11 20:45:00 30
2019-09-11 20:50:00 2019-09-12 14:20:00 31
2019-09-12 14:40:00 2019-09-13 00:10:00 32
2019-09-13 00:10:00 2019-09-13 14:05:00 33
2019-09-13 14:15:00 2019-09-14 21:25:00 34
2019-09-14 21:30:00 2019-09-15 13:45:00 35
2019-09-15 14:00:00 2019-09-16 13:50:00 36
2019-09-16 14:05:00 2019-09-20 14:40:00 37
2019-09-20 18:20:00 2019-09-21 14:10:00 38
2019-09-21 19:00:00 2019-09-22 15:05:00 39
2019-09-22 17:10:00 2019-09-22 20:45:00 40
2019-09-23 00:50:00 2019-09-23 14:45:00 41
2019-09-24 00:00:00 2019-09-24 14:40:00 42
2019-09-24 17:00:00 2019-09-24 21:00:00 43
2019-09-25 00:50:00 2019-09-25 17:35:00 44
2019-09-26 00:25:00 2019-09-26 14:50:00 45
2019-09-27 01:35:00 2019-09-27 17:00:00 46
2019-09-27 20:20:00 2019-09-28 14:35:00 47
2019-09-28 23:30:00 2019-09-29 14:55:00 48
2019-09-30 01:50:00 2019-09-30 14:45:00 49
2019-10-01 02:00:00 2019-10-01 16:10:00 50
2019-10-01 23:45:00 2019-10-02 14:55:00 51
2019-10-02 19:50:00 2019-10-05 01:35:00 52
2019-10-05 01:35:00 2019-10-16 14:50:00 53
2019-10-16 16:10:00 2019-10-17 14:55:00 54
2019-10-18 01:50:00 2019-10-18 14:55:00 55
2019-10-18 15:05:00 2019-10-19 16:30:00 56
2019-10-19 20:30:00 2019-10-20 01:55:00 57
2019-10-20 02:20:00 2019-10-20 17:00:00 58
2019-10-20 21:40:00 2019-10-21 18:35:00 59
2019-10-21 19:40:00 2019-10-23 14:50:00 60
2019-10-23 15:20:00 2019-10-31 16:10:00 61
2019-10-31 18:15:00 2019-11-01 02:15:00 62
2019-11-01 02:30:00 2019-11-01 15:05:00 63
2019-11-01 15:35:00 2019-11-02 15:05:00 64
2019-11-02 15:35:00 2019-11-03 16:05:00 65
2019-11-03 16:55:00 2019-11-05 22:40:00 66
2019-11-06 02:25:00 2019-11-06 15:00:00 67
2019-11-07 02:10:00 2019-11-07 15:25:00 68
2019-11-08 01:10:00 2019-11-08 15:30:00 69
2019-11-09 00:15:00 2019-11-09 22:40:00 70
2019-11-10 00:10:00 2019-11-10 15:30:00 71
2019-11-10 16:25:00 2019-11-10 22:25:00 72
2019-11-11 00:55:00 2019-11-11 16:40:00 73
2019-11-11 18:05:00 2019-11-12 23:25:00 74
2019-11-13 00:15:00 2019-11-13 20:40:00 75
2019-11-13 21:30:00 2019-11-14 19:00:00 76
2019-11-15 02:10:00 2019-11-15 16:10:00 77
2019-11-16 02:25:00 2019-11-16 16:30:00 78
2019-11-17 00:15:00 2019-11-17 17:00:00 79
2019-11-18 02:05:00 2019-11-18 20:40:00 80
2019-11-19 00:15:00 2019-11-19 17:05:00 81
2019-11-19 19:20:00 2019-11-21 02:25:00 82
2019-11-21 02:35:00 2019-11-21 17:20:00 83
2019-11-22 01:30:00 2019-11-22 18:00:00 84
2019-11-23 02:30:00 2019-11-23 17:15:00 85
2019-11-23 21:20:00 2019-11-24 18:45:00 86
2019-11-25 02:15:00 2019-11-25 19:25:00 87
2019-11-25 20:20:00 2019-11-26 00:15:00 88
2019-11-26 01:15:00 2020-03-23 19:15:00 89
2020-03-24 03:25:00 2020-03-24 20:05:00 90
2020-03-25 03:25:00 2020-03-25 16:25:00 91
2020-03-25 20:20:00 2020-03-26 16:10:00 92
2020-03-26 21:25:00 2020-03-27 16:00:00 93
2020-03-27 17:25:00 2020-03-27 21:20:00 94
2020-03-28 03:15:00 2020-03-28 16:25:00 95
2020-03-29 03:10:00 2020-03-29 16:30:00 96
2020-03-30 02:55:00 2020-03-30 16:15:00 97
2020-03-31 02:45:00 2020-03-31 15:45:00 98
2020-04-01 03:00:00 2020-04-01 16:25:00 99
2020-04-02 01:50:00 2020-04-02 22:20:00 100
2020-04-03 02:50:00 2020-04-03 15:30:00 101
2020-04-04 02:50:00 2020-04-04 18:10:00 102
2020-04-04 19:00:00 2020-04-04 19:10:00 103
2020-04-04 21:00:00 2020-04-05 02:25:00 104
2020-04-05 02:40:00 2020-04-05 15:20:00 105
2020-04-05 16:20:00 2020-04-05 21:55:00 106
2020-04-05 22:35:00 2020-04-06 15:30:00 107
2020-04-06 16:15:00 2020-04-06 23:05:00 108
2020-04-06 23:45:00 2020-04-07 15:50:00 109
2020-04-07 17:55:00 2020-04-08 16:10:00 110
2020-04-08 19:10:00 2020-04-10 16:15:00 111
2020-04-10 22:40:00 2020-04-13 17:20:00 112
2020-04-13 18:40:00 2020-04-15 01:10:00 113
2020-04-15 02:30:00 2020-04-18 17:55:00 114
2020-04-18 20:30:00 2020-04-20 02:00:00 115
2020-04-20 02:40:00 2020-04-20 15:05:00 116
2020-04-20 19:00:00 2020-04-21 22:55:00 117
2020-04-21 23:10:00 2020-04-24 15:45:00 118
2020-04-24 23:15:00 2020-04-25 15:10:00 119
2020-04-26 01:45:00 2020-04-26 15:15:00 120
2020-04-26 19:25:00 2020-04-27 15:10:00 121
2020-04-28 01:45:00 2020-04-28 15:15:00 122
2020-04-29 01:30:00 2020-04-29 15:10:00 123
2020-04-30 01:20:00 2020-04-30 15:10:00 124
2020-04-30 20:55:00 2020-05-01 15:20:00 125
2020-05-02 00:25:00 2020-05-02 15:40:00 126
2020-05-02 23:30:00 2020-05-03 16:00:00 127
2020-05-04 00:15:00 2020-05-04 15:10:00 128
2020-05-04 23:50:00 2020-05-05 14:40:00 129
2020-05-05 18:05:00 2020-05-05 20:05:00 130
2020-05-05 22:45:00 2020-05-06 14:45:00 131
2020-05-06 22:40:00 2020-05-07 15:20:00 132
2020-05-07 18:10:00 2020-05-08 17:00:00 133
2020-05-08 23:25:00 2020-05-09 15:50:00 134
2020-05-09 17:30:00 2020-05-13 15:05:00 135
2020-05-13 21:00:00 2020-05-14 14:30:00 136
2020-05-14 22:00:00 2020-05-15 14:45:00 137
2020-05-15 22:05:00 2020-05-16 14:45:00 138
2020-05-16 21:30:00 2020-05-17 13:40:00 139
2020-05-17 21:15:00 2020-05-18 13:20:00 140
2020-05-18 20:50:00 2020-05-19 13:50:00 141
2020-05-19 20:35:00 2020-05-20 17:20:00 142
2020-05-20 20:40:00 2020-05-21 15:25:00 143
2020-05-21 18:40:00 2020-05-26 15:15:00 144
2020-05-26 20:15:00 2020-05-27 14:35:00 145
2020-05-27 19:10:00 2020-05-28 12:25:00 146
2020-05-28 13:10:00 2020-05-29 16:25:00 147
2020-05-29 17:20:00 2020-05-30 13:05:00 148
2020-05-30 13:40:00 2020-05-31 13:55:00 149
2020-05-31 17:30:00 2020-06-01 12:55:00 150
2020-06-01 13:45:00 2020-08-09 17:55:00 151
2020-08-09 18:00:00 2020-08-17 12:55:00 152
2020-08-17 20:30:00 2020-08-18 13:10:00 153
2020-08-18 18:40:00 2020-08-19 13:25:00 154
2020-08-19 16:05:00 2020-08-19 18:25:00 155
2020-08-19 21:00:00 2020-08-20 15:30:00 156
2020-08-20 21:40:00 2020-08-21 13:55:00 157
2020-08-21 22:05:00 2020-08-22 14:05:00 158
2020-08-22 22:10:00 2020-08-23 13:05:00 159
2020-08-23 17:05:00 2020-08-23 21:05:00 160
2020-08-23 21:50:00 2020-08-24 14:55:00 161
2020-08-24 21:35:00 2020-08-25 13:20:00 162
2020-08-25 13:25:00 2020-08-26 15:55:00 163
2020-08-26 20:55:00 2020-08-27 14:05:00 164
2020-08-27 15:20:00 2020-08-27 16:55:00 165
2020-08-27 18:15:00 2020-08-28 18:05:00 166
2020-08-28 22:00:00 2020-08-29 18:35:00 167
2020-08-29 19:55:00 2020-08-30 23:10:00 168
2020-08-30 23:20:00 2020-09-01 13:40:00 169
2020-09-01 14:05:00 2020-09-03 15:25:00 170
2020-09-03 16:05:00 2020-09-03 17:45:00 171
2020-09-03 20:40:00 2020-09-04 13:45:00 172
2020-09-04 20:00:00 2020-09-05 14:40:00 173
2020-09-05 23:55:00 2020-09-06 13:50:00 174
2020-09-06 15:20:00 2020-09-06 18:05:00 175
2020-09-06 20:05:00 2020-09-07 13:45:00 176
2020-09-07 14:10:00 2020-09-11 13:40:00 177
2020-09-11 13:55:00 2020-09-12 13:40:00 178
2020-09-12 14:05:00 2020-09-13 13:40:00 179
2020-09-13 13:55:00 2020-09-15 13:35:00 180
2020-09-15 13:50:00 2020-09-16 19:10:00 181
2020-09-16 20:25:00 2020-09-17 18:45:00 182
2020-09-17 21:30:00 2020-09-18 14:10:00 183
2020-09-19 00:20:00 2020-09-19 14:45:00 184
2020-09-19 21:55:00 2020-09-20 15:15:00 185
2020-09-20 23:15:00 2020-09-21 15:15:00 186
2020-09-21 23:50:00 2020-09-22 15:40:00 187
2020-09-22 16:20:00 2020-09-23 18:55:00 188
2020-09-23 19:50:00 2020-09-24 14:40:00 189
2020-09-24 14:40:00 2020-09-25 15:10:00 190
2020-09-25 15:10:00 2020-09-26 15:10:00 191
2020-09-26 15:10:00 2020-09-27 18:25:00 192
2020-09-27 19:10:00 2020-09-28 20:45:00 193